package com.diqizu.servlet.admin;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.diqizu.dao.GonSiDaoImpl;
import com.diqizu.entity.GongSi;

import com.diqizu.servlet.BaseServlet;
import com.diqizu.utli.Result;

/**
 * Servlet implementation class GongsiAdmin
 */
@WebServlet("/admin/GongsiAdmin")
public class GongsiAdmin extends BaseServlet {

	GonSiDaoImpl gs = new GonSiDaoImpl();

	public void getList5(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		GongSi com =gs.getALlgs();
		String res = Result.toClient(0, "公司", com);
		PrintWriter out = resp.getWriter();
		out.write(res);
		out.flush();
		out.close();
	}
	public void updategs(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String id = req.getParameter("id");
		String homeIntro = req.getParameter("homeIntro");
		String info =req.getParameter("info");
		String zsTel =req.getParameter("zsTel");
		String tel =req.getParameter("tel");
		String adress =req.getParameter("adress");
		String x =req.getParameter("x");
		String y =req.getParameter("y");
		GongSi com =new GongSi();
		com.setAdress(adress);
		com.setHomeIntro(homeIntro);
		com.setId(Integer.valueOf(id));
		com.setInfo(info);
		com.setTel(Integer.valueOf(zsTel));
		com.setX(x);
		com.setY(y);
		com.setZsTel(Integer.valueOf(tel));
		boolean res = gs.getALllb7(com);
		PrintWriter out = resp.getWriter();
		if (res) {
			out.write(Result.toClient(0, "修改成功"));
		} else {
			out.write(Result.toClient(1, "修改失败"));
		}

		out.flush();
		out.close();
	}
}


